/**
 * jqGrid列生成设置管理初始化
 */
var ColModel = {
    layerIndex: -1
};

/**
 * 点击添加jqGrid列生成设置
 */
ColModel.openAddColModel = function () {
    var index = layer.open({
        type: 2,
        title: '添加jqGrid列生成设置',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/colModel/colModel_add'
    });
    this.layerIndex = index;
};

/**
 * 打开查看jqGrid列生成设置详情
 */
ColModel.openColModelDetail = function (id) {
    var index = layer.open({
        type: 2,
        title: 'jqGrid列生成设置详情',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/colModel/colModel_update/' + id
    });
    this.layerIndex = index;
};

/**
 * 查看jqGrid列生成设置详情
 */
ColModel.openColModelView = function (id) {
	var index = layer.open({
		type: 2,
		title: 'jqGrid列生成设置详情',
		area: ['800px', '420px'], //宽高
		fix: false, //不固定
		maxmin: true,
		content: Feng.ctxPath + '/colModel/colModel_update/' + id,
		success: function(layero, index){
			//input设置为只读
		   $("input[class='form-control']", layero.find("iframe")[0].contentWindow.document).attr("readonly",true).css({"border":"none","outline":"none","background-color":"#fff"});
		  	 //隐藏提交按钮
		   $("#ensure", layero.find("iframe")[0].contentWindow.document).hide();
		},
	});
	this.layerIndex = index;
};

/**
 * 删除jqGrid列生成设置
 */
ColModel.delete = function (id) {
    var ajax = new $ax(Feng.ctxPath + "/colModel/delete", function (data) {
        Feng.success("删除成功!");
        $("#refresh_ColModelGrid", window.parent.document).click();	//重新载入 
    }, function (data) {
        Feng.error("删除失败!" + data.responseJSON.message + "!");
    });
    ajax.set("colModelId", id);
    ajax.start();
};

